package com.sxs.controller;

import com.sxs.commonutils.R;
import com.sxs.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Create by Intellij IDEA
 * @Author: songXuSheng
 * @Date: 2021/9/12 21:48
 */
@RestController
@RequestMapping("/eduOss/fileOss")
@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;
//    上传文件
    @PostMapping
    public R uploadFile(MultipartFile file){
      String urlOfOss=ossService.uploadeFileAvatar(file);
        return R.ok().data("urlOfOss",urlOfOss);
    }
}
